/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.classdiagram.figures;

import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;

import com.cea.papyrus.core.PapyrusPlugin;
import com.cea.papyrus.core.figures.LabelFigure;

/**
 * figure that contains enumeration literals.
 */
public class EnumerationLiteralFigure extends LabelFigure {


	protected Label label=new Label();

	protected String name="";

	protected String stereotypes="";



	public EnumerationLiteralFigure()
	{

		FontData[] font={new FontData("Arial", 9, SWT.NORMAL)};
		setFont(PapyrusPlugin.fontManager.get(font));
		setLabelAlignment(PositionConstants.LEFT );
	}


	/**
	 * To add a name.
	 * 
	 * @param name of the figure
	 */
	public void setName(String name){
		this.name=name;
		setText(name);
		display();
	}


	/**
	 * 
	 */
	public void setEnumerationLiteral(){
		display();
	}


	/**
	 * 
	 */
	public void display(){
		setText(stereotypes+" "+name);
	}

	/**
	 * to add stereotypes.
	 * 
	 * @param name of the operation
	 * @param st 
	 */
	@Override
	public void setStereotypes(String st){
		if (st==null) {
			this.stereotypes="";
		} else {
			this.stereotypes=PapyrusPlugin.ST_LEFT+st+PapyrusPlugin.ST_RIGHT;
		}
		display();
	}


}
